﻿using DevExpress.XtraGrid.Demos.util;
using DiaoPaiDaYin;
using Luna小店.DTO;
using Luna小店.UC.门店下单.DTO;
using mendian;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DXApplicationTangche.UC.门店下单.service
{
    public class 下单相关Service
    {
        /// <summary>
        /// select接口查设计点
        /// </summary>
        /// <param name="styleNameCn"></param>
        /// <returns></returns>
        public static List<DTODesignPoints> select接口查设计点(String styleNameCn)
        {
            List<DTODesignPoints> Dto设计点s = FunctionHelper
                .JsonDeserialization<List<DTODesignPoints>>(
                RestCall.httpGetMethod(
                    URL.接口url +
                    "/recipe/getCraftFacadeStyleDesignDTOByStyleNameCn?styleNameCn=" + styleNameCn));
            for (int i = Dto设计点s.Count-1; i > 0; i--)
            {
                if (String.IsNullOrWhiteSpace(Dto设计点s[i].optionValue) && String.IsNullOrWhiteSpace(Dto设计点s[i].name))
                {
                    Dto设计点s.RemoveAt(i);
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine(Dto设计点s[i].optionValue + "=========" + Dto设计点s[i].name + "=======================");
                }
            }
            return Dto设计点s;
        }

        /// <summary>
        /// 查询默认设计点及可选设计点
        /// </summary>
        /// <param name="styleNameCn"></param>
        /// <returns></returns>
        public static List<DesignPointsFacadeDTO> getDesignPointsFacadeByStyleName(String styleNameCn)
        {
            return
                FunctionHelper.JsonDeserialization<List<DesignPointsFacadeDTO>>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/recipe/getDesignPointsFacadeByStyleName?styleNameCn=" + styleNameCn
                        )
                    );
        }
    }
    /// <summary>
    /// 默认设计点及可选设计点
    /// </summary>
    public class DesignPointsFacadeDTO
    {
        public DTODesignPoints defaultDtoDesignPoints;    //  默认设计点
        public List<DTODesignPoints> optionDtoDesignPoints;    //  可选设计点
        public DesignPointsFacadeDTO()
        {

        }

    }
}
